<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  .container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    /* 元素之间的间距 */
  }

  .item {
    flex: 1;
    /* flex-grow, flex-shrink, flex-basis */
    min-width: 300px;
    /* 确保元素最小宽度 */
    /* 其他样式 */
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
  }

  /* 可选：在较小屏幕上强制单列显示 */
  /* @media (max-width: 768px) {
    .item {
      flex-basis: 100%;
      min-width: 100%;
    }
  } */
</style>

<body>
  <div class="container">
    <div class="item">内容项 1</div>
    <div class="item">内容项 fsdaaadsdddddddddddddd2</div>
    <div class="item">内容项 3</div>
    <div class="item">内容项 ddddddddddddddddddddd4</div>
    <div class="item">内容项 dddddddddddddd1</div>
    <div class="item">内容项 2</div>
    <div class="item">内容项 3</div>
    <div class="item">内容项 4</div>
  </div>
</body>

</html>